import Cookies from 'js-cookie'

const TokenKey = 'access-token'
const UserIdKey = 'access-userId'
const UserNameKey = 'access-userName'
const ResourcesKey = 'access-resources'

export function getToken () {
  // console.log('cookie get token:' + Cookies.get(TokenKey))
  return Cookies.get(TokenKey)
}

export function setToken (token) {
  // console.log('cookie write token:' + token)
  return Cookies.set(TokenKey, token)
}

export function removeToken () {
  return Cookies.remove(TokenKey)
}

export function setUserId (UserId) {
  return Cookies.set(UserIdKey, UserId)
}
export function getUserId () {
  return Cookies.get(UserIdKey)
}

export function removeUserId () {
  return Cookies.remove(UserIdKey)
}

export function setName (userName) {
  return Cookies.set(UserNameKey, userName)
}
export function getName () {
  return Cookies.get(UserNameKey)
}

export function removeName () {
  return Cookies.remove(UserNameKey)
}

export function setResources (resources) {
  return Cookies.set(ResourcesKey, resources)
}
export function getResources () {
  return Cookies.get(ResourcesKey)
}

export function removeResources () {
  return Cookies.remove(ResourcesKey)
}
